package mr.ali.video.web.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import mr.ali.video.web.model.Collection;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Mr-ali
 * @since 2025-08-03
 */
@Repository
public interface CollectionMapper extends BaseMapper<Collection> {

    @Update("update collection set displayed =#{displayed}  where id=#{id}")
    Integer updateDisplayed(@Param("id") Integer id, @Param("displayed") Integer displayed);

    /**
     * 剧集的已发布的计数*/
    @Select("select COUNT(*) from collection where type = #{type}")
    Integer CountByTypeId(Integer type);
}
